import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

class MyPage extends StatefulWidget {
  const MyPage({super.key});

  @override
  State<MyPage> createState() => _MyPageState();
}

class _MyPageState extends State<MyPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: BrnAppBar(
          //自定义左侧icon
          leading: Image.asset(
            'assets/image/icon_navbar_sousuo_hei.png',
            scale: 3.0,
            width: 20,
            height: 20,
          ),
          themeData: BrnAppBarConfig.light(),
          //文本title
          title: '我的',
        ),
        body: BrnActionCardTitle(
          title: '音乐馆',
          accessoryText: '听音乐',
          onTap: () {
            //跳转
            _launchURL("https://miuu_note.gitee.io/music/");
          },
        ));
  }

  _launchURL(url) async {
    if (!await launchUrl(Uri.parse('https://miuu_note.gitee.io/music/'),
        mode: LaunchMode.inAppWebView)) {
      throw Exception('Could not launch $url');
    }
  }
}
